package com.maxd.service.helpTask;

import com.maxd.model.Commodity;
import com.maxd.model.HelpClassifyDetails;
import com.maxd.respository.commodity.CommodityJpaRepository;
import com.maxd.respository.commodity.CommodityRepository;
import com.maxd.respository.helpTask.HelpClassifyDetailsJpaRepository;
import com.maxd.respository.helpTask.HelpClassifyDetailsRepository;
import com.maxd.respository.helpTask.HelpClassifyJpaRepository;
import com.maxd.service.Commodity.CommodityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 二级分类
 */
@Service
public class HelpClassifyDetailsServiceImpl implements HelpClassifyDetailsService {

    @Autowired
    private HelpClassifyDetailsJpaRepository helpClassifyDetailsJpaRepository;
    @Autowired
    private HelpClassifyDetailsRepository helpClassifyDetailsRepository;


    @Override
    public List<HelpClassifyDetails> selectList(Long classifyId) {
        return helpClassifyDetailsRepository.selectList(classifyId);
    }

    @Override
    public List<HelpClassifyDetails> selectList(String classifyName) {
        return helpClassifyDetailsRepository.selectList(classifyName);
    }

    @Override
    public List<HelpClassifyDetails> selectList() {
        return helpClassifyDetailsRepository.selectList();
    }

    @Override
    public HelpClassifyDetails selectById(Long id) {
        return helpClassifyDetailsRepository.selectById(id);
    }

    @Override
    public HelpClassifyDetails save(HelpClassifyDetails helpClassifyDetails) {
        return helpClassifyDetailsJpaRepository.save(helpClassifyDetails);
    }

    @Override
    public void saveAll(List<HelpClassifyDetails> list) {
        helpClassifyDetailsJpaRepository.saveAll(list);
    }

    @Override
    public HelpClassifyDetails update(HelpClassifyDetails helpClassifyDetails) {
        return helpClassifyDetailsJpaRepository.save(helpClassifyDetails);
    }

    @Override
    public void deleteById(Long id) {
        helpClassifyDetailsJpaRepository.deleteById(id);
    }

    @Override
    @Transactional
    public void deleteByIdList(String ids) {
        String []id=ids.split(",");
        for(String i:id){
            helpClassifyDetailsJpaRepository.deleteById(Long.parseLong(i));
        }

    }

}
